package cn.iocoder.yudao.module.erp.dal.mysql.dpwest;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.dpitem.dpwestlistdn.vo.DpWestListDnPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.dplist.DpWestListDnDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 东宁西线清单 Mapper
 * @author 天使管理员
 */
@Mapper
public interface DpWestListDnMapper extends BaseMapperX<DpWestListDnDO> {

    default PageResult<DpWestListDnDO> selectPage(DpWestListDnPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DpWestListDnDO>()
                .eqIfPresent(DpWestListDnDO::getNo, reqVO.getNo())
                .eqIfPresent(DpWestListDnDO::getItemNo, reqVO.getItemNo())
                .likeIfPresent(DpWestListDnDO::getProductName, reqVO.getProductName())
                .eqIfPresent(DpWestListDnDO::getProductNameRu, reqVO.getProductNameRu())
                .eqIfPresent(DpWestListDnDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(DpWestListDnDO::getTotal, reqVO.getTotal())
                .eqIfPresent(DpWestListDnDO::getWeight, reqVO.getWeight())
                .eqIfPresent(DpWestListDnDO::getVolume, reqVO.getVolume())
                .eqIfPresent(DpWestListDnDO::getPicture, reqVO.getPicture())
                .eqIfPresent(DpWestListDnDO::getTaxRefundStatus, reqVO.getTaxRefundStatus())
                .orderByDesc(DpWestListDnDO::getId));
    }

    default List<DpWestListDnDO> selectListByNo(String no) {
        return selectList(DpWestListDnDO::getNo, no);
    }

    default int deleteByNo(String no) {
        return delete(DpWestListDnDO::getNo, no);
    }
}